package com.community.itelligentcommunity.sys.vo;


import com.community.itelligentcommunity.sys.entity.Tree;
import com.community.itelligentcommunity.sys.entity.UserRole;

import java.util.ArrayList;
import java.util.List;

public class UserRoleVo extends UserRole {

    private String treeArray;

    public String getTreeArray() {
        return treeArray;
    }

    public void setTreeArray(String treeArray) {
        this.treeArray = treeArray;
    }

    public void packagingTrees(String treeArray){
        Tree tree = null;
        List<Tree> trees = new ArrayList<>();
        for(String id:treeArray.split(",")){
            if(!id.isEmpty()){
                tree = new Tree(Integer.parseInt(id));
                trees.add(tree);
            }
        }
        this.setTreeList(trees);
    }

}
